import permision from "@/js_sdk/wa-permission/permission.js";
import User from "./user.js";
export default{
		updated:false,
	//网络监听
		//网络状态
		isConnect:false,
		//监听网络状态
		onNetworkType(){
			//获取当前网络状态
			// console.log(111);
			uni.getNetworkType({
			    success:(res) => {
			        if(res.networkType!=='none'){
						this.isConnect=true;
						return;
						 }
					uni.showToast({
						icon:'none',
						title:'请先连接网络'
					})
			    }
			});
			//监听网络状态变化
			uni.onNetworkStatusChange((res)=> {
			    this.isConnect =res.isConnected;
				if(!res.isConnected){
					uni.showToast({
						icon:'none',
						title:'您目前处于断网状态'
					})
				
				}
			});
		},
		
		location(){
		 var result	= permision.checkSystemEnableLocation();
		 // console.log(result);
		 if(!result){
			uni.showModal({
				showCancel:false,
				title:"提示",
				content:"您的定位没有开启，请开启再重新启动APP",
				success: (res) => {
					if(res.confirm){
						plus.runtime.quit(); 
					}
				}
			}) 
		 }
		},
}